package com.mlk.good.api;

import com.mlk.constant.OK;
import com.mlk.core.component.page.Pager;
import com.mlk.core.util.ServerResponse;
import com.mlk.good.service.EngGoodService;
import com.mlk.good.vo.EngGoodVO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/api/good")
public class EngGoodAPI {

    @Resource
    private EngGoodService engGoodService;

    /**
     * 查询现有积分
     * @param openId
     * @return
     */
    @GetMapping("queryScore")
    public ServerResponse queryScore(String openId){
        return this.engGoodService.queryScore(openId);
    }


    /**
     * 商品列表
     * @return
     */
    @GetMapping("goodList")
    @OK
    public Pager goodList(EngGoodVO good){
        return this.engGoodService.goodList(good);
    }

    /**
     * 获取商品的banner
     * @param goodId
     * @return
     */
    @GetMapping("getGoodBanner")
    @OK
    public ServerResponse getGoodBanner(String goodId){
        return this.engGoodService.getGoodBanner(goodId);
    }

    /**
     * 获取商品主体信息
     * @return
     */
    @GetMapping("getGoodMainInfo")
    @OK
    public ServerResponse getGoodMainInfo(String goodId){
        return this.engGoodService.getGoodMainInfo(goodId);
    }

    /**
     * 获取商品介绍信息
     * @param goodId
     * @return
     */
    @GetMapping("getGoodIntroduce")
    @OK
    public ServerResponse getGoodIntroduce(String goodId){
        return this.engGoodService.getGoodIntroduce(goodId);
    }

    /**
     * 获取商品规格参数信息
     * @return
     */
    @GetMapping("getGoodParamList")
    public ServerResponse getGoodParamList(String goodId){
        return this.engGoodService.getGoodParamList(goodId);
    }

}
